//
// Created by FindBin on 2024/5/1.
//
#pragma once


#include "main.h"
//#include "ModBusRTU.h"

#define AirCYLINDER_RS485              (RS485_1_UART)
#define AirCYLINDER_RS485_BUFFER       (rs485_rx_Buffer_1)
#define AirCYLINDER_RS485_BUFFER_SIZE  (RS485_BUFFER_SIZE_1)
//typedef enum {
//    RESET_RETRY = 0xa1,
//    GET,
//    TEST,
//    ALL_OPEN,
//    ALL_CLOSE,
//    CONTROL
//} FunctionCode;

#define AirCylinder_BIT(x) (1 << x)

#define AirCylinder_TEST_NUB 0x0e
#define AirCylinder_GET_NUB 0x0a
typedef enum {
    airCylinder_c1 = 0,
    airCylinder_c2,
    airCylinder_c3,
    airCylinder_c4,
    airCylinder_c5,
    airCylinder_c6,
    airCylinder_c7,
    airCylinder_c8,
} AirCylinder_CC;

void airCylinder_cb(_Bool is_continue);

void airCylinder_init();

void airCylinder_all_open(FDCAN_HandleTypeDef *hfdcan, uint8_t id);

//void airCylinder_close(uint8_t id, AirCylinder_CC airCylinderCc);

void airCylinder_all_close(FDCAN_HandleTypeDef *hfdcan, uint8_t id);

_Bool airCylinder_test(uint8_t id);

uint8_t airCylinder_get(uint8_t id);
void airCylinder_open(FDCAN_HandleTypeDef *hfdcan, uint8_t id,uint8_t port);
void airCylinder_close(FDCAN_HandleTypeDef *hfdcan, uint8_t id,uint8_t port);